Implement these on win32, currently only for button 1. Fixes the resize
authorRobert Ögren <gtk@roboros.com>
Sat, 30 Oct 2004 18:04:49 +0000 (18:04 +0000)
committerHans Breuer <hans@src.gnome.org>
Sat, 30 Oct 2004 18:04:49 +0000 (18:04 +0000)
2004-10-29  Robert Ögren  <gtk@roboros.com>

* gdk/win32/gdkwindow-win32.c (gdk_window_begin_resize_drag),
(gdk_window_begin_move_drag): Implement these on win32, currently
only for button 1. Fixes the resize grip of GtkStatusbar on
win32. (#143285)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gdk/win32/gdkwindow-win32.c

index 54535ca3d107ba70f1ae75c6437464b7613b2097..769f75c9b262adddefd2e7954f5c8d8c52025918 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2004-10-29  Robert Ögren  <gtk@roboros.com>
+
+       * gdk/win32/gdkwindow-win32.c (gdk_window_begin_resize_drag),
+       (gdk_window_begin_move_drag): Implement these on win32, currently
+       only for button 1. Fixes the resize grip of GtkStatusbar on 
+       win32. (#143285)
+
 2004-10-30  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtktextbtree.c (_gtk_text_btree_select_range): Redisplay
index 54535ca3d107ba70f1ae75c6437464b7613b2097..769f75c9b262adddefd2e7954f5c8d8c52025918 100644 (file)
@@ -1,3 +1,10 @@
+2004-10-29  Robert Ögren  <gtk@roboros.com>
+
+       * gdk/win32/gdkwindow-win32.c (gdk_window_begin_resize_drag),
+       (gdk_window_begin_move_drag): Implement these on win32, currently
+       only for button 1. Fixes the resize grip of GtkStatusbar on 
+       win32. (#143285)
+
 2004-10-30  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtktextbtree.c (_gtk_text_btree_select_range): Redisplay
index 54535ca3d107ba70f1ae75c6437464b7613b2097..769f75c9b262adddefd2e7954f5c8d8c52025918 100644 (file)
@@ -1,3 +1,10 @@
+2004-10-29  Robert Ögren  <gtk@roboros.com>
+
+       * gdk/win32/gdkwindow-win32.c (gdk_window_begin_resize_drag),
+       (gdk_window_begin_move_drag): Implement these on win32, currently
+       only for button 1. Fixes the resize grip of GtkStatusbar on 
+       win32. (#143285)
+
 2004-10-30  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtktextbtree.c (_gtk_text_btree_select_range): Redisplay
index 54535ca3d107ba70f1ae75c6437464b7613b2097..769f75c9b262adddefd2e7954f5c8d8c52025918 100644 (file)
@@ -1,3 +1,10 @@
+2004-10-29  Robert Ögren  <gtk@roboros.com>
+
+       * gdk/win32/gdkwindow-win32.c (gdk_window_begin_resize_drag),
+       (gdk_window_begin_move_drag): Implement these on win32, currently
+       only for button 1. Fixes the resize grip of GtkStatusbar on 
+       win32. (#143285)
+
 2004-10-30  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtktextbtree.c (_gtk_text_btree_select_range): Redisplay
index 8d5826d8333c01f518e8df54146cc20acb60af48..6c114dac8281b45e84a7753e8d3f8ea0cd1c3564 100644 (file)
@@ -2842,12 +2842,63 @@ gdk_window_begin_resize_drag (GdkWindow     *window,
                               gint           root_y,
                               guint32        timestamp)
 {
+  WPARAM winedge;
+  
   g_return_if_fail (GDK_IS_WINDOW (window));
   
   if (GDK_WINDOW_DESTROYED (window))
     return;
 
-  /* XXX: isn't all this default on win32 ... */  
+  /* Tell Windows to start interactively resizing the window by pretending that
+   * the left pointer button was clicked in the suitable edge or corner. This
+   * will only work if the button is down when this function is called, and
+   * will only work with button 1 (left), since Windows only allows window
+   * dragging using the left mouse button */
+  if (button != 1)
+    return;
+  
+  /* Must break the automatic grab that occured when the button was pressed,
+   * otherwise it won't work */
+  gdk_display_pointer_ungrab (gdk_display_get_default (), 0);
+
+  switch (edge)
+    {
+    case GDK_WINDOW_EDGE_NORTH_WEST:
+      winedge = HTTOPLEFT;
+      break;
+
+    case GDK_WINDOW_EDGE_NORTH:
+      winedge = HTTOP;
+      break;
+
+    case GDK_WINDOW_EDGE_NORTH_EAST:
+      winedge = HTTOPRIGHT;
+      break;
+
+    case GDK_WINDOW_EDGE_WEST:
+      winedge = HTLEFT;
+      break;
+
+    case GDK_WINDOW_EDGE_EAST:
+      winedge = HTRIGHT;
+      break;
+
+    case GDK_WINDOW_EDGE_SOUTH_WEST:
+      winedge = HTBOTTOMLEFT;
+      break;
+
+    case GDK_WINDOW_EDGE_SOUTH:
+      winedge = HTBOTTOM;
+      break;
+
+    case GDK_WINDOW_EDGE_SOUTH_EAST:
+    default:
+      winedge = HTBOTTOMRIGHT;
+      break;
+    }
+
+  DefWindowProc (GDK_WINDOW_HWND (window), WM_NCLBUTTONDOWN, winedge,
+      MAKELPARAM (root_x - _gdk_offset_x, root_y - _gdk_offset_y));
 }
 
 void
@@ -2862,7 +2913,20 @@ gdk_window_begin_move_drag (GdkWindow *window,
   if (GDK_WINDOW_DESTROYED (window))
     return;
 
-  /* XXX: isn't all this default on win32 ... */  
+  /* Tell Windows to start interactively moving the window by pretending that
+   * the left pointer button was clicked in the titlebar. This will only work
+   * if the button is down when this function is called, and will only work
+   * with button 1 (left), since Windows only allows window dragging using the
+   * left mouse button */
+  if (button != 1)
+    return;
+  
+  /* Must break the automatic grab that occured when the button was pressed,
+   * otherwise it won't work */
+  gdk_display_pointer_ungrab (gdk_display_get_default (), 0);
+
+  DefWindowProc (GDK_WINDOW_HWND (window), WM_NCLBUTTONDOWN, HTCAPTION,
+      MAKELPARAM (root_x - _gdk_offset_x, root_y - _gdk_offset_y));
 }